<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.ereport.entity.Projects"%>
<%@page import="com.ereport.entity.AccContacts"%>
<%@page import="java.util.List"%>
<%@page import="java.text.DateFormat"%>
<%@page import="com.ereport.entity.Accounts"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=application.getContextPath()%>/css/datatable.css"/>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>
<script type="text/javascript" language="javascript" src="<%=application.getContextPath()%>/js/jquery.dataTables.nightly.js"></script>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/colResizable-1.3.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function(){
    $('#iTable').dataTable();
    $("#iTable").colResizable();
});

</script>

</head>
<body>
<table width="927" style="height:880px" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="../common/exe-header.jsp" %>
    </td>
 <style>
 #field, label { float: left; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
 .dataTables_filter{
 width:195px
 }
 .dataTables_info{ font-size: 12px;}
 tr.odd td.sorting_1{
 background-color:#CCCCCC;
 }
 </style>
  </tr>
  <tr>
    <td  align="left" valign="top"><table width="927" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="20">&nbsp;</td>
        <td width="643" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">&nbsp;<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a></td>
              <td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
            </tr>
          </table>
        </td>
        <td width="20">&nbsp;</td>
      </tr>
      
      <tr>
        <td width="20">&nbsp;</td>
        <td align="center" valign="top" class="heading">Projects</td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="right"></td>
        <td>&nbsp;</td>
      </tr>
      <%
      
      %>
      <tr>
        <td>&nbsp;</td>
        <td align="center" valign="top"><table width="870" border="0" cellspacing="0" cellpadding="0">
       <tr>
            <td align="left" valign="top">
           <table width="895" border="0" align="center" cellpadding="0" cellspacing="0" class="box-border1">
           
              <tr>
             <td width="250" align="left" class="hed-blc">&nbsp;</td>
              </tr>
           <tr>
             <td width="250" align="left" class="hed-blc">Executive 
      			<select name="exeName" id="exeName" class="textfield required" tabindex="1" onchange="javascript: getExeProjs()">
                	 <option value="">Please Select</option>
                	 <option value="">All</option>
                	<%
                		List<Executives> exlist=(List<Executives>)request.getAttribute("exlist");
                 		for(int i=0;i<exlist.size();i++){
                 		String exeName="";
                 		if(request.getParameter("exeName")!=null){
                 		exeName=request.getParameter("exeName");
                 		}
                	%>
                	<option value="<%= exlist.get(i).getId()%>" <%if(exlist.get(i).getExeName().equals(exeName)){ %> selected="selected" <%} %>><%= exlist.get(i).getExeName()%></option>
                	<%
                	
                 	}
                 	%>
                 </select> 
                 </td>
              </tr>
           <tr>
             <td width="250" align="left" class="hed-blc">&nbsp;</td>
              </tr>
           <tr>
             <td width="250" align="left" class="hed-blc">&nbsp;</td>
              </tr>
              <tr>
                <td><%
                if(request.getAttribute("prList")!=null){
                List<Projects> prList=(List<Projects>)request.getAttribute("prList");
               
                %>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" >
                 
              <tr>
                <td>
                <div id="prjlistdiv">
                <div id="allProjs">
                <table width="100%" border="0" align="center"  cellpadding="5" cellspacing="1" bgcolor="#787878"  id="iTable" >
                   <thead>
                  <tr style="background:url('<%=application.getContextPath() %>/images/hed-bg-block-2.jpg'); background-repeat:repeat-x; background-position:left top">
                   	<th width="5%"  height="30" align="center" valign="middle"  class="hed"  style="background-repeat:repeat-x">S.No</th>
                   	<th width="14%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Project Name</th>
                   	<th width="14%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Project Type</th>
                    <th width="19%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x"> Organisation </th>
                    <th width="10%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Division</th>
                    <th width="19%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Industry Type</th>
                   	<th width="13%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Created Date</th>
                   	<th width="13%"  align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x">Executive</th>
                   
                  </tr>
                  </thead>
                  <tbody>
                  <%
                  if(prList!=null){
                  	for(int i=0;i<prList.size();i++){
                   	//System.out.println("aclist "+aclist.get(i).getContactName());
                  %>
                  <tr >
                   <%
                          String lcdate="";
                   
                         Date ldt=prList.get(i).getCreatedDate();
                         if(ldt!=null){
                          DateFormat ldft=new SimpleDateFormat("dd-MM-yyyy");
                          	lcdate=ldft.format(ldt.getTime());
                         }
                         
                    %>
                   
                    <td bgcolor="#cccccc" align="center"><%=i+1 %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                   	<a href="javascript:getProj('<%=prList.get(i).getProjectName() %>')" style="color: #1d7d92"><%=prList.get(i).getProjectName() %></a></td>
		            <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=prList.get(i).getTypeOfProj() %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=prList.get(i).getOrgName() %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=prList.get(i).getDivision() %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=prList.get(i).getTypeOfIndustry() %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=lcdate %></td>
                    <td align="center" valign="top" bgcolor="#cccccc" class="tableCell">
                    <%=prList.get(i).getExeId().getExeName() %>
                    <input type="hidden" id="exeid" value="<%=prList.get(i).getExeId().getId() %>"/>
                    </td>
                 </tr>
                 <%
                  	}
                  	
                  }
                 %>
                </tbody>
                </table>
                </div>
                <div id="exeProjs"></div>
                </div>
                </td>
              </tr>
              
                </table>
                <%} %>
                </td>
              </tr>
             
              <tr>
              <td>
              <div id="projDet"></div>
              </td>
              </tr>
             
            </table>                       </td>
 		 </tr>
      </table></td>
        <td>&nbsp;</td>
      </tr>
      
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
    </table></td>
  </tr>
  <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<script>
function getExeProjs(){
	var exeid=$("#exeName").val();
	var data="exeid="+exeid;
	$.ajax({
		url:"<%=application.getContextPath()%>/project/getPrjByExeId.do",
		mimetype:"text/html",
		data:data,
		method:"post",
		cache:false,
		success: function(res){
			$("#projDet").hide();
				$("#allProjs").hide();
				$("#exeProjs").html(res).show();
			}
		});
}
</script>
<script>
function getProj(proj){
	var exeid=$("#exeid").val();
	var data="exeid="+exeid+"&proj="+proj;
	//alert(data);
	$.ajax({
		url:"<%=application.getContextPath()%>/project/getPrjByExeIdAndProj.do",
		mimetype:"text/html",
		data:data,
		method:"post",
		cache:false,
		success: function(res){
				
				$("#projDet").html(res).show();
			}
		});
}
</script>